<?php

use think\migration\Migrator;
use think\migration\db\Column;

/**
 * 工况 - 通用表，用在首页
 */
class CompanyIndustryMonitorCommonMinute extends Migrator
{
    public function up()
    {
        $table = $this->table('company_industry_monitor_common_minute');

        $table
            // step1:发布时间
            ->addColumn('publish_time', 'datetime', ['comment' => '数据发布的分钟时间'])
            ->addColumn('publish_type', 'string', ['limit' => 50, 'comment' => '发布类型N脱硝S脱硫'])

            //step2:相关ID和名称
            ->addColumn('region_id', 'integer', ['limit' => 11, 'comment' => '区域ID'])
            ->addColumn('industry_id', 'integer', ['limit' => 11, 'comment' => '电力供热等ID'])
            ->addColumn('industry_name', 'string', ['limit' => 20, 'comment' => '电力供热等名称'])
            ->addColumn('company_id', 'integer', ['limit' => 11, 'comment' => '公司ID'])
            ->addColumn('company_name', 'string', ['limit' => 50, 'comment' => '公司名称'])
            ->addColumn('drain_id', 'integer', ['limit' => 11, 'comment' => '排口ID'])
            ->addColumn('drain_name', 'string', ['limit' => 50, 'comment' => '排口名称'])
            ->addColumn('facility_id', 'integer', ['limit' => 11, 'comment' => '工艺设施ID'])
            ->addColumn('facility_number', 'string', ['limit' => 50, 'comment' => '工艺设施编号'])

            //step3:运行参数
            ->addColumn('operation_concentration', 'string', ['limit' => 20, 'comment' => '运行浓度'])
            ->addColumn('operating_efficiency', 'string', ['limit' => 20, 'comment' => '运行效率'])

            //step4:时间
            ->addColumn('create_time', 'string', ['limit' => 50, 'comment' => '插入时间'])

            //注释
            ->setComment('工况 - 工业企业监测 - 公共数据（分钟）- MongoDB')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('company_industry_monitor_common_minute')->drop();
    }
}
